

Ext.define('Demo.view.purchase.purchaseInstoragePanel',{
	extend: 'Ext.panel.Panel',
	alias: 'widget.purchaseInstoragePanel',
	items: [
	        {
	        	xtype: 'topBar',
	        	id: "purchaseInstorageTop",
	        	store: Ext.create("Demo.store.purchase.purchaseInstorageStore",{})
	        },
	        {
	        	xtype:"form",
	        	layout:'column',
	        	items:[
	        	       {
		        	    	 xtype: 'testText1',
					    	 name: 'supplierNo',
							 fieldLabel: '供应商',
	        	       },
					   {		
							 style: 'margin:10px 0px 0px 60px;',
					    	 xtype: 'datefield',
							 name: 'billDate',
							 bodyPadding: 5,
							 fieldLabel: '单据日期',
							 width: 250,
							 labelWidth: 80,
							 format: 'y-m-d',
							 value: new Date()
					   },
					   {
					    	 xtype: 'testText1',
							 name: 'addressNo',
							 fieldLabel: '供应商地址',
							 width: 150,
					   },
					   {	
						   	 style: 'margin-top:10px',
						   	 xtype: 'testText1',
							 name: 'addressName',
							 width: 100 ,
					   },
					   {
						   	 xtype: 'testText1',
							 name: 'billNo',
							 fieldLabel: '单据号码',
							 width: 250,
					   },
					   {
						   	style: 'margin:10px 0px 0px 60px;',
						     xtype: 'combo',
					    	 name: 'saleClassId',
							 bodyPadding: 5,
							 fieldLabel: '采购入库类型',
							 width: 250,
							 labelWidth: 80,
							 store: Ext.create('Ext.data.Store', {
									fields: ['value', 'text'],
			    					data : [
			    					        {"value":"1", "text":"普通"},
			    					        {"value":"2", "text":"加急"}
			    					        ]
								}),
							  
					   },
					   {
						     xtype: 'testText1',
							 name: 'moneyType',
							 fieldLabel: '币别',
							 width: 250,
							 value: '人民币'
					   },
					   {
						     style: 'margin:10px 0px 0px 60px;',
						     xtype: 'combo',
					    	 name: 'isTax',
							 bodyPadding: 5,
							 fieldLabel: '单价是否含税',
							 width: 250,
							 labelWidth: 80,
							 displayField: 'name',
							 valueField: 'abbr',
							 
							 store: Ext.create('Ext.data.Store', {
									fields: ['abbr', 'name'],
			    					data : [
			    					        {"abbr":"1", "name":"未税"},
			    					        {"abbr":"2", "name":"含税"}
			    					        ]
								}),
							 
					   },
					   {
						     xtype: 'testText1',
							 name: 'exchRate',
							 fieldLabel: '汇率',
							 width: 250,
							 value: '1.0000'
					   },
					   {
						     xtype: 'testText1',
							 name: 'wareNo',
							 fieldLabel: '仓库',
					   },
					   {
						     xtype: 'testText1',
							 name: 'hasForeignTrade',
							 fieldLabel: '国外贸易'
							
					   },
					   {
						   	 xtype: 'testText1',
							 name: 'pzbh',
							 fieldLabel: '凭证编号',
					   },
					  /* {
						     style: 'margin:10px 0px 0px 62px;',
						     xtype: 'checkbox',
							 name: '',
							 bodyPadding: 5,
							 hideLabels:true,
							 checkboxToggle:true,
							 boxLabel:"复核后自动生成发票",
							 anchor: '100%',
					         items:[{boxLabel:"复核后自动生成发票",inputValue:1,checked:true}]
					   },*/{
							xtype: 'tabpanel',
						    width: 950,
							height: 230,
							style: 'margin:10px 0px 0px 60px',
							items: [
							        {
							        	title:'内容',
							        	items:[
											   { 
												   xtype: 'panel',
												   width: 2000,
												   items:[
												          {
												        	  xtype: 'grid',
												        	  store: Ext.create("Ext.data.Store",{
												        	          fields:[
												        	        {
													        	      	name:"lineId",type:'int'
													        	    },{
												        	      		name:"materialNo",type:'string'
												        	      	},{
												        	      		name:"materialName",type:'string'
												        	      	},{
												        	      		name:"materialSize",type:'string'
												        	      	},{
												        	      		name:"unitName",type:'string'
												        	      	},{
												        	      		name:"quantity",type:'int'
												        	      	},{
												        	      		name:"discountPrice",type:'double'
												        	      	},{
												        	      		name:"discountNumber",type:'double'
												        	      	},{
												        	      		name:"price",type:'double'
												        	      	},{
												        	      		name:"tolamount",type:'double'
												        	      	},{
												        	      		name:"taxRate",type:'double'
												        	      	},{
												        	      		name:"taxamount",type:'double'
												        	      	},{
												        	      		name:"tolamountAndTax",type:'double'
												        	      	},{
												        	      		name:"isGift",type:'int'
												        	      	},{
												        	      		name:"note",type:'string'
												        	      	},{
												        	      		name:"orderForm",type:'int'
												        	      	},{
												        	      		name:"orderNoForm",type:'string'
												        	      	},{
												        	      		name:"apportion",type:'double'
												        	      	}]
												         
												          	})   ,
												        	  height: 160,
												        	  columns: [
												        	            {xtype: 'rownumberer', header: '（栏号）', name: 'lineId', dataIndex: 'lineId', width: 50,sortable: false },
												        		        {header: '物料编号', dataIndex: 'materialNo', width: 100 ,editor:"textfield"},
												        		       	{header: '物料名称', dataIndex: 'materialName', width: 120,editor:"textfield" },
												        		       	{header: '规格型号', dataIndex: 'materialSize' ,editor:"textfield"},
												        				{header: '单位名称', dataIndex: 'unitName' ,editor:"textfield"},
												        				{header: '数量', dataIndex: 'quantity',editor:"textfield"},
												        				{header: '折扣前单价', dataIndex: 'discountPrice',editor:"textfield" },
												        				{header: '折数(%)', dataIndex: 'discountNumber' ,editor:"textfield"},
												        				{header: '单价', dataIndex: 'price' ,editor:"textfield"},
												        				{header: '金额', dataIndex: 'tolamount' ,editor:"textfield"},
												        				{header: '税率', dataIndex: 'taxRate',editor:"textfield" },
												        				{header: '税额', dataIndex: 'taxamount' ,editor:"textfield"},
												        				{header: '含税金额', dataIndex: 'tolamountAndTax',editor:"textfield" },
												        				{header: '赠品', dataIndex: 'isGift',editor:"textfield" },
												        				{header: '分录备注', dataIndex: 'note',editor:"textfield" },
												        				{header: '来源单别', dataIndex: 'orderForm' ,editor:"textfield"},
												        				{header: '来源单号', dataIndex: 'orderNoForm' ,editor:"textfield"},
												        				{header: '分摊费用', dataIndex: 'apportion',editor:"textfield" }
												        			   ],
												        	  plugins: [  
												        	            Ext.create('Ext.grid.plugin.CellEditing',{  
												        					clicksToEdit:1 //设置单击单元格编辑  
												        				})  
												        			   ],  
												        	  listeners:{
												        				 //双击行事件  
												        		  itemdblclick:function(dataview, record, item, index, e){
												        			  alert('itemdblclick');
												        			  var data  = {  
												        			  };
												        			  //添加一行表格
												        			  this.getStore().add(data);
												        		}
												        	  }
												          	}
												          ],
												   bbar:[
												         {xtype:"label",text:'总计:',width:90},
												         {xtype:"textfield",disabled:true,width:90,margin:'0 180',value:'0.00'},
												         {xtype:"textfield",disabled:true,width:90,margin:'0',value:'0.00'},
												         {xtype:"textfield",disabled:true,width:90,margin:'0 40 0 30',value:'0.00'},
												         {xtype:"textfield",disabled:true,width:90,margin:'0 0 0 0',value:'0.00'}
												        ]
											    }
							        	      ]
							        },
							        {title:'账款'},
							        {title:'备注'}
							       ],
					   }
					   ,{
						   xtyle: 'form',
						   store: ['sale.xsckdStore'],
						   layout: 'column',
						   baseCls: 'x-plain',
						   items:[
						          {
									xtype: 'testText1',
									name: 'bizMan',
									fieldLabel: '业务人员',
						          },
								  {
									xtype: 'testText1',
									name: 'maker',
									fieldLabel: '制单人员',
								  },
								  {
									 xtype: 'testText1',
									 name: '',
									 fieldLabel: '所属部门',
								  },
								  {
									 xtype: 'testText1',
									 name: 'permitter',
									 fieldLabel: '复核人员',
								  },
								  {
									 xtype: 'testText1',
									 name: '',
									 fieldLabel: '所属项目',
								  }
						         ]
					   	}
					  ]
	        }
	      ]
});